package com.tc.gateway.tunnel;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.LinkedList;
import java.util.Queue;

public class MultiOutputStream extends OutputStream{
	InetAddress group = null;
	MulticastSocket socket = null;

	int port;
	public MultiOutputStream(InetAddress g,	MulticastSocket s, int po)
	{
		this.group = g;
		this.socket = s;
		this.port = po;
	
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		DatagramPacket p = new DatagramPacket(b,off,len, group, port); 
		socket.send(p);
	}

	@Override
	public void write(byte[] b) throws IOException {
		DatagramPacket p = new DatagramPacket(b,0,b.length, group, port); 
		socket.send(p);
	}

	@Override
	public void write(int b) throws IOException {
		throw new RuntimeException("...");
		
	}
}
